#pragma once
#include <cxcore.h>
#include <cv.h>
#include <highgui.h>
#include <math.h>
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include "Display.h"
using namespace std;

int compare_frame_difference(IplImage *frame1, IplImage *frame2){
	int DIFFERENT = 1;		//ASSUME TO BE DIFFERENT
	IplImage *frame1_gray = cvCreateImage(cvGetSize(frame1),8,1);
	IplImage *frame2_gray = cvCreateImage(cvGetSize(frame2),8,1);
	cvCvtColor(frame1,frame1_gray,CV_RGB2GRAY);
	cvCvtColor(frame2,frame2_gray,CV_RGB2GRAY);

	CvMat *velx = cvCreateMat(frame1->height,frame1->width,CV_32FC1);
	CvMat *vely = cvCreateMat(frame1->height,frame1->width,CV_32FC1);
	IplImage *velx_img = cvCreateImage(cvGetSize(frame1),IPL_DEPTH_32F,1);
	IplImage *vely_img = cvCreateImage(cvGetSize(frame1),IPL_DEPTH_32F,1);

	//STRATEGY 1. SUBTRACT 


	//STRATEGY 2. OPTICAL FLOW
	cvCalcOpticalFlowLK(frame1_gray,frame2_gray,cvSize(3,3),velx_img,vely_img);
//	Display("velx_img",velx_img);	Display("vely_img",vely_img);
//	cin.get();

	return DIFFERENT;
}
